<template>
  <XtxBread>
    <XtxBreadItem to="/">首页</XtxBreadItem>
    <XtxBreadItem :to="`/category/${category.parentId}`">
      {{ category.parentName }}
    </XtxBreadItem>
    <transition name="fade-right" mode="out-in">
      <XtxBreadItem :key="category.id">
        {{ category.name }}
      </XtxBreadItem>
    </transition>
  </XtxBread>
</template>

<script>
import { inject } from 'vue'
export default {
  name: 'SubBread',
  setup () {
    // 接收父组件提供的数据
    const category = inject('category')
    // console.log(category)
    return { category }
  }
}
</script>
